#!/bin/bash

# 检查是否有参数传入
if [ $# -eq 0 ]; then
  echo "Usage: $0 { build | clean }"
  exit 1
fi

# 根据第一个参数执行操作
case "$1" in
  build)
    gcc socket_client.c ./protocol/simple_protocol.c ./protocol/simple_protocol.h -o client --std=c99
    gcc socket_server.c ./protocol/simple_protocol.c ./protocol/simple_protocol.h ../utils/mpool.c ../utils/log.c -o server --std=c99
    ;;
  clean)
    rm main client server -f
    ;;
  *)
    echo "Error: Unknown command '$1'"
    exit 1
    ;;
esac